<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="68px"
    >
      <el-form-item label="商品" prop="productName">
        <el-input
          v-model.trim="queryParams.productName"
          placeholder="请输入商品"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="订单号" prop="orderNumber">
        <el-input
          v-model.trim="queryParams.orderNumber"
          placeholder="请输入订单号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="时间范围" prop="dataDate">
        <timeRange @OptionsRange="OptionsRange" :value="dateRange" />
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
        <el-button
          :icon="!isOpen ? 'el-icon-arrow-down' : 'el-icon-arrow-up'"
          size="mini"
          @click="shouqi"
          >展开/收起</el-button
        >
      </el-form-item>

      <div v-if="isOpen">
        <el-form-item label="商品数量(件)" prop="productQuantity">
          <el-input
            v-model.trim="queryParams.productQuantity"
            placeholder="请输入商品数量(件)"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="是否审核中" prop="isReviewing">
          <el-input
            v-model.trim="queryParams.isReviewing"
            placeholder="请输入是否审核中"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="支付时间" prop="dataDate">
          <el-date-picker
            clearable
            v-model="queryParams.dataDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择支付时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="承诺发货时间" prop="commitShipmentDate">
          <el-date-picker
            clearable
            v-model="queryParams.commitShipmentDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择承诺发货时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="承诺送达时间" prop="promiseDeliveryTime">
          <el-input
            v-model.trim="queryParams.promiseDeliveryTime"
            placeholder="请输入承诺送达时间"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="发货时间" prop="estimatedShipmentDate">
          <el-input
            v-model.trim="queryParams.estimatedShipmentDate"
            placeholder="请输入发货时间"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="确认收货时间" prop="confirmationTime">
          <el-date-picker
            clearable
            v-model="queryParams.confirmationTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择确认收货时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="商品成本" prop="productCost">
          <el-input
            v-model.trim="queryParams.productCost"
            placeholder="请输入商品成本"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="商品ID" prop="productId">
          <el-input
            v-model.trim="queryParams.productId"
            placeholder="请输入商品ID"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="商品规格" prop="productSpecification">
          <el-input
            v-model.trim="queryParams.productSpecification"
            placeholder="请输入商品规格"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="样式ID" prop="styleId">
          <el-input
            v-model.trim="queryParams.styleId"
            placeholder="请输入样式ID"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="商品一级类目" prop="productFirstCategory">
          <el-input
            v-model.trim="queryParams.productFirstCategory"
            placeholder="请输入商品一级类目"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="商品二级类目" prop="productSecondCategory">
          <el-input
            v-model.trim="queryParams.productSecondCategory"
            placeholder="请输入商品二级类目"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="商品三级类目" prop="productThirdCategory">
          <el-input
            v-model.trim="queryParams.productThirdCategory"
            placeholder="请输入商品三级类目"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="商品四级类目" prop="productFourthCategory">
          <el-input
            v-model.trim="queryParams.productFourthCategory"
            placeholder="请输入商品四级类目"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="商家编码-规格维度" prop="merchantCodeSpec">
          <el-input
            v-model.trim="queryParams.merchantCodeSpec"
            placeholder="请输入商家编码-规格维度"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="商家编码-商品维度" prop="merchantProductCode">
          <el-input
            v-model.trim="queryParams.merchantProductCode"
            placeholder="请输入商家编码-商品维度"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="商家备注" prop="merchantNotes">
          <el-input
            v-model.trim="queryParams.merchantNotes"
            placeholder="请输入商家备注"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="买家留言" prop="buyerMessage">
          <el-input
            v-model.trim="queryParams.buyerMessage"
            placeholder="请输入买家留言"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="消费者资料" prop="consumerData">
          <el-input
            v-model.trim="queryParams.consumerData"
            placeholder="请输入消费者资料"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="订单成交时间" prop="orderCompletionTime">
          <el-date-picker
            clearable
            v-model="queryParams.orderCompletionTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择订单成交时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="消费者资料上传时间" prop="consumerDataUploadTime">
          <el-date-picker
            clearable
            v-model="queryParams.consumerDataUploadTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择消费者资料上传时间"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="赠品名称" prop="giftName">
          <el-input
            v-model.trim="queryParams.giftName"
            placeholder="请输入赠品名称"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="赠品id" prop="giftId">
          <el-input
            v-model.trim="queryParams.giftId"
            placeholder="请输入赠品id"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="赠品规格" prop="giftSpec">
          <el-input
            v-model.trim="queryParams.giftSpec"
            placeholder="请输入赠品规格"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="赠品数量" prop="giftQuantity">
          <el-input
            v-model.trim="queryParams.giftQuantity"
            placeholder="请输入赠品数量"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="团ID" prop="groupId">
          <el-input
            v-model.trim="queryParams.groupId"
            placeholder="请输入团ID"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="团身份" prop="groupIdentity">
          <el-input
            v-model.trim="queryParams.groupIdentity"
            placeholder="请输入团身份"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="是否已开始配送" prop="hasStartedDelivery">
          <el-input
            v-model.trim="queryParams.hasStartedDelivery"
            placeholder="请输入是否已开始配送"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="配送员是否已送达" prop="hasDeliveryCompleted">
          <el-input
            v-model.trim="queryParams.hasDeliveryCompleted"
            placeholder="请输入配送员是否已送达"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="同城是否普通快递" prop="isCityDelivery">
          <el-input
            v-model.trim="queryParams.isCityDelivery"
            placeholder="请输入同城是否普通快递"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="商品总价(元)" prop="totalPrice">
          <el-input
            v-model.trim="queryParams.totalPrice"
            placeholder="请输入商品总价(元)"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="邮费(元)" prop="postalFee">
          <el-input
            v-model.trim="queryParams.postalFee"
            placeholder="请输入邮费(元)"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="店铺优惠折扣(元)" prop="storeDiscountAmount">
          <el-input
            v-model.trim="queryParams.storeDiscountAmount"
            placeholder="请输入店铺优惠折扣(元)"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="平台优惠折扣(元)" prop="platformDiscountAmount">
          <el-input
            v-model.trim="queryParams.platformDiscountAmount"
            placeholder="请输入平台优惠折扣(元)"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item
          label="多多支付立减金额(元)"
          prop="multiplePaymentDiscountAmount"
        >
          <el-input
            v-model.trim="queryParams.multiplePaymentDiscountAmount"
            placeholder="请输入多多支付立减金额(元)"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="上门安装费(元)" prop="homeInstallationAmount">
          <el-input
            v-model.trim="queryParams.homeInstallationAmount"
            placeholder="请输入上门安装费(元)"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="送货入户费(元)" prop="deliveryFee">
          <el-input
            v-model.trim="queryParams.deliveryFee"
            placeholder="请输入送货入户费(元)"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item
          label="送货入户并安装费(元)"
          prop="deliveryInstallationFee"
        >
          <el-input
            v-model.trim="queryParams.deliveryInstallationFee"
            placeholder="请输入送货入户并安装费(元)"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="用户实付金额(元)" prop="userPaidAmount">
          <el-input
            v-model.trim="queryParams.userPaidAmount"
            placeholder="请输入用户实付金额(元)"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="商家实收金额(元)" prop="receivedAmount">
          <el-input
            v-model.trim="queryParams.receivedAmount"
            placeholder="请输入商家实收金额(元)"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="快递单号" prop="trackingNumber">
          <el-input
            v-model.trim="queryParams.trackingNumber"
            placeholder="请输入快递单号"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="快递公司" prop="expressCompany">
          <el-input
            v-model.trim="queryParams.expressCompany"
            placeholder="请输入快递公司"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="省" prop="province">
          <el-input
            v-model.trim="queryParams.province"
            placeholder="请输入省"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="市" prop="cityName">
          <el-input
            v-model.trim="queryParams.cityName"
            placeholder="请输入市"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="区" prop="area">
          <el-input
            v-model.trim="queryParams.area"
            placeholder="请输入区"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="街道/镇" prop="streetOrTown">
          <el-input
            v-model.trim="queryParams.streetOrTown"
            placeholder="请输入街道/镇"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="配送员手机号" prop="deliveryPhoneNumber">
          <el-input
            v-model.trim="queryParams.deliveryPhoneNumber"
            placeholder="请输入配送员手机号"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="是否抽奖或0元试用" prop="isPromotionOrFree">
          <el-input
            v-model.trim="queryParams.isPromotionOrFree"
            placeholder="请输入是否抽奖或0元试用"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="是否顺丰加价" prop="isFasterExpressPrice">
          <el-input
            v-model.trim="queryParams.isFasterExpressPrice"
            placeholder="请输入是否顺丰加价"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="用户购买手机号" prop="userPurchasedPhoneNumber">
          <el-input
            v-model.trim="queryParams.userPurchasedPhoneNumber"
            placeholder="请输入用户购买手机号"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="旅行类信息" prop="travelDistance">
          <el-input
            v-model.trim="queryParams.travelDistance"
            placeholder="请输入旅行类信息"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="充值号码" prop="rechargeNumber">
          <el-input
            v-model.trim="queryParams.rechargeNumber"
            placeholder="请输入充值号码"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="是否门店自提" prop="isStorePickup">
          <el-input
            v-model.trim="queryParams.isStorePickup"
            placeholder="请输入是否门店自提"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="逻辑删除" prop="isDelete">
          <el-input
            v-model.trim="queryParams.isDelete"
            placeholder="请输入逻辑删除"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="店铺id" prop="shopId">
          <el-input
            v-model.trim="queryParams.shopId"
            placeholder="请输入店铺id"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
      </div>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['pdd:BiPddOrderDwd:add']"
          >新增</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['pdd:BiPddOrderDwd:edit']"
          >修改</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['pdd:BiPddOrderDwd:remove']"
          >删除</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['pdd:BiPddOrderDwd:export']"
          >导出</el-button
        >
      </el-col>
      <el-col :span="1.5">
         <uploadFileShopid
          @handleSuccess="getList"
          :uploadUrl="'/pdd/BiPddOrderDwd/importData'"
        />
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          size="mini"
          @click="handleorderCostCalculatorByIds"
          >按ID计算成本</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" plain size="mini" @click="openInfo = true"
          >按时间计算成本</el-button
        >
      </el-col>
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>

    <el-table
      v-loading="loading"
      :data="BiPddOrderDwdList"
      @selection-change="handleSelectionChange"
      :height="650"
    >
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="id" align="center" prop="id" />
      <el-table-column
        width="160"
        label="商品"
        align="center"
        prop="productName"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        width="160"
        label="订单号"
        align="center"
        prop="orderNumber"
      />
      <el-table-column
        width="160"
        label="订单状态"
        align="center"
        prop="orderStatus"
      />
      <el-table-column
        width="160"
        label="商品数量(件)"
        align="center"
        prop="productQuantity"
      />
      <el-table-column
        width="160"
        label="是否审核中"
        align="center"
        prop="isReviewing"
      />
      <el-table-column
        width="160"
        label="支付时间"
        align="center"
        prop="dataDate"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.dataDate, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column
        width="160"
        label="承诺发货时间"
        align="center"
        prop="commitShipmentDate"
      >
        <template slot-scope="scope">
          <span>{{
            parseTime(scope.row.commitShipmentDate, "{y}-{m}-{d}")
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        width="160"
        label="承诺送达时间"
        align="center"
        prop="promiseDeliveryTime"
      />
      <el-table-column
        width="160"
        label="发货时间"
        align="center"
        prop="estimatedShipmentDate"
      />
      <el-table-column
        width="160"
        label="确认收货时间"
        align="center"
        prop="confirmationTime"
      >
        <template slot-scope="scope">
          <span>{{
            parseTime(scope.row.confirmationTime, "{y}-{m}-{d}")
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        width="160"
        label="商品成本"
        align="center"
        prop="productCost"
      />
      <el-table-column
        width="160"
        label="商品ID"
        align="center"
        prop="productId"
      />
      <el-table-column
        width="160"
        label="商品规格"
        align="center"
        prop="productSpecification"
      />
      <el-table-column
        width="160"
        label="样式ID"
        align="center"
        prop="styleId"
      />
      <el-table-column
        width="160"
        label="商品一级类目"
        align="center"
        prop="productFirstCategory"
      />
      <el-table-column
        width="160"
        label="商品二级类目"
        align="center"
        prop="productSecondCategory"
      />
      <el-table-column
        width="160"
        label="商品三级类目"
        align="center"
        prop="productThirdCategory"
      />
      <el-table-column
        width="160"
        label="商品四级类目"
        align="center"
        prop="productFourthCategory"
      />
      <el-table-column
        width="160"
        label="商家编码-规格维度"
        align="center"
        prop="merchantCodeSpec"
      />
      <el-table-column
        width="160"
        label="商家编码-商品维度"
        align="center"
        prop="merchantProductCode"
      />
      <el-table-column
        width="160"
        label="商家备注"
        align="center"
        prop="merchantNotes"
      />
      <el-table-column
        width="160"
        label="买家留言"
        align="center"
        prop="buyerMessage"
      />
      <el-table-column
        width="160"
        label="售后状态"
        align="center"
        prop="postSaleStatus"
      />
      <el-table-column
        width="160"
        label="消费者资料"
        align="center"
        prop="consumerData"
      />
      <el-table-column
        width="160"
        label="订单成交时间"
        align="center"
        prop="orderCompletionTime"
      >
        <template slot-scope="scope">
          <span>{{
            parseTime(scope.row.orderCompletionTime, "{y}-{m}-{d}")
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        width="160"
        label="消费者资料上传时间"
        align="center"
        prop="consumerDataUploadTime"
      >
        <template slot-scope="scope">
          <span>{{
            parseTime(scope.row.consumerDataUploadTime, "{y}-{m}-{d}")
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        width="160"
        label="赠品名称"
        align="center"
        prop="giftName"
      />
      <el-table-column
        width="160"
        label="赠品id"
        align="center"
        prop="giftId"
      />
      <el-table-column
        width="160"
        label="赠品规格"
        align="center"
        prop="giftSpec"
      />
      <el-table-column
        width="160"
        label="赠品数量"
        align="center"
        prop="giftQuantity"
      />
      <el-table-column width="160" label="团ID" align="center" prop="groupId" />
      <el-table-column
        width="160"
        label="团身份"
        align="center"
        prop="groupIdentity"
      />
      <el-table-column
        width="160"
        label="是否已开始配送"
        align="center"
        prop="hasStartedDelivery"
      />
      <el-table-column
        width="160"
        label="配送员是否已送达"
        align="center"
        prop="hasDeliveryCompleted"
      />
      <el-table-column
        width="160"
        label="配送状态"
        align="center"
        prop="deliveryStatus"
      />
      <el-table-column
        width="160"
        label="同城是否普通快递"
        align="center"
        prop="isCityDelivery"
      />
      <el-table-column
        width="160"
        label="商品总价(元)"
        align="center"
        prop="totalPrice"
      />
      <el-table-column
        width="160"
        label="邮费(元)"
        align="center"
        prop="postalFee"
      />
      <el-table-column
        width="160"
        label="店铺优惠折扣(元)"
        align="center"
        prop="storeDiscountAmount"
      />
      <el-table-column
        width="160"
        label="平台优惠折扣(元)"
        align="center"
        prop="platformDiscountAmount"
      />
      <el-table-column
        width="160"
        label="多多支付立减金额(元)"
        align="center"
        prop="multiplePaymentDiscountAmount"
      />
      <el-table-column
        width="160"
        label="上门安装费(元)"
        align="center"
        prop="homeInstallationAmount"
      />
      <el-table-column
        width="160"
        label="送货入户费(元)"
        align="center"
        prop="deliveryFee"
      />
      <el-table-column
        width="160"
        label="送货入户并安装费(元)"
        align="center"
        prop="deliveryInstallationFee"
      />
      <el-table-column
        width="160"
        label="用户实付金额(元)"
        align="center"
        prop="userPaidAmount"
      />
      <el-table-column
        width="160"
        label="商家实收金额(元)"
        align="center"
        prop="receivedAmount"
      />
      <el-table-column
        width="160"
        label="快递单号"
        align="center"
        prop="trackingNumber"
      />
      <el-table-column
        width="160"
        label="快递公司"
        align="center"
        prop="expressCompany"
      />
      <el-table-column width="160" label="省" align="center" prop="province" />
      <el-table-column width="160" label="市" align="center" prop="cityName" />
      <el-table-column width="160" label="区" align="center" prop="area" />
      <el-table-column
        width="160"
        label="街道/镇"
        align="center"
        prop="streetOrTown"
      />
      <el-table-column
        width="160"
        label="配送员手机号"
        align="center"
        prop="deliveryPhoneNumber"
      />
      <el-table-column
        width="160"
        label="是否抽奖或0元试用"
        align="center"
        prop="isPromotionOrFree"
      />
      <el-table-column
        width="160"
        label="是否顺丰加价"
        align="center"
        prop="isFasterExpressPrice"
      />
      <el-table-column
        width="160"
        label="用户购买手机号"
        align="center"
        prop="userPurchasedPhoneNumber"
      />
      <el-table-column
        width="160"
        label="旅行类信息"
        align="center"
        prop="travelDistance"
      />
      <el-table-column
        width="160"
        label="充值号码"
        align="center"
        prop="rechargeNumber"
      />
      <el-table-column
        width="160"
        label="是否门店自提"
        align="center"
        prop="isStorePickup"
      />
      <el-table-column
        width="160"
        label="逻辑删除"
        align="center"
        prop="isDelete"
      />
      <el-table-column width="160" label="备注" align="center" prop="remark" />
      <el-table-column
        width="160"
        label="店铺id"
        align="center"
        prop="shopId"
      />
      <el-table-column label="店铺名称" align="center" prop="shopName" />
      <el-table-column
        width="160"
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['pdd:BiPddOrderDwd:edit']"
            >修改</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['pdd:BiPddOrderDwd:remove']"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改拼多多订单对话框 -->
    <el-dialog
      :title="title"
      :visible.sync="open"
      width="1500px"
      append-to-body
    >
      <el-form ref="form" :model="form" :rules="rules" label-width="150px">
        <el-row :gutter="10" class="mb8">
          <el-col :span="8">
            <el-form-item label="商品" prop="productName">
              <el-input
                v-model.trim="form.productName"
                placeholder="请输入商品"
              />
            </el-form-item>
            <el-form-item label="订单号" prop="orderNumber">
              <el-input
                v-model.trim="form.orderNumber"
                placeholder="请输入订单号"
              />
            </el-form-item>
            <el-form-item label="商品数量(件)" prop="productQuantity">
              <el-input
                v-model.trim="form.productQuantity"
                placeholder="请输入商品数量(件)"
              />
            </el-form-item>
            <el-form-item label="是否审核中" prop="isReviewing">
              <el-input
                v-model.trim="form.isReviewing"
                placeholder="请输入是否审核中"
              />
            </el-form-item>
            <el-form-item label="支付时间" prop="dataDate">
              <el-date-picker
                clearable
                v-model="form.dataDate"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择支付时间"
              >
              </el-date-picker>
            </el-form-item>
            <el-form-item label="承诺发货时间" prop="commitShipmentDate">
              <el-date-picker
                clearable
                v-model="form.commitShipmentDate"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择承诺发货时间"
              >
              </el-date-picker>
            </el-form-item>
            <el-form-item label="承诺送达时间" prop="promiseDeliveryTime">
              <el-input
                v-model.trim="form.promiseDeliveryTime"
                placeholder="请输入承诺送达时间"
              />
            </el-form-item>
            <el-form-item label="发货时间" prop="estimatedShipmentDate">
              <el-input
                v-model.trim="form.estimatedShipmentDate"
                placeholder="请输入发货时间"
              />
            </el-form-item>
            <el-form-item label="确认收货时间" prop="confirmationTime">
              <el-date-picker
                clearable
                v-model="form.confirmationTime"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择确认收货时间"
              >
              </el-date-picker>
            </el-form-item>
            <el-form-item label="商品成本" prop="productCost">
              <el-input
                v-model.trim="form.productCost"
                placeholder="请输入商品成本"
              />
            </el-form-item>
            <el-form-item label="商品ID" prop="productId">
              <el-input
                v-model.trim="form.productId"
                placeholder="请输入商品ID"
              />
            </el-form-item>
            <el-form-item label="商品规格" prop="productSpecification">
              <el-input
                v-model.trim="form.productSpecification"
                placeholder="请输入商品规格"
              />
            </el-form-item>
            <el-form-item label="样式ID" prop="styleId">
              <el-input
                v-model.trim="form.styleId"
                placeholder="请输入样式ID"
              />
            </el-form-item>
            <el-form-item label="商品一级类目" prop="productFirstCategory">
              <el-input
                v-model.trim="form.productFirstCategory"
                placeholder="请输入商品一级类目"
              />
            </el-form-item>
            <el-form-item label="商品二级类目" prop="productSecondCategory">
              <el-input
                v-model.trim="form.productSecondCategory"
                placeholder="请输入商品二级类目"
              />
            </el-form-item>
            <el-form-item label="商品三级类目" prop="productThirdCategory">
              <el-input
                v-model.trim="form.productThirdCategory"
                placeholder="请输入商品三级类目"
              />
            </el-form-item>
            <el-form-item label="商品四级类目" prop="productFourthCategory">
              <el-input
                v-model.trim="form.productFourthCategory"
                placeholder="请输入商品四级类目"
              />
            </el-form-item>
            <el-form-item label="商家编码-规格维度" prop="merchantCodeSpec">
              <el-input
                v-model.trim="form.merchantCodeSpec"
                placeholder="请输入商家编码-规格维度"
              />
            </el-form-item>
            <el-form-item label="商家编码-商品维度" prop="merchantProductCode">
              <el-input
                v-model.trim="form.merchantProductCode"
                placeholder="请输入商家编码-商品维度"
              />
            </el-form-item>
            <el-form-item label="商家备注" prop="merchantNotes">
              <el-input
                v-model.trim="form.merchantNotes"
                placeholder="请输入商家备注"
              />
            </el-form-item> </el-col
          ><el-col :span="8">
            <el-form-item label="买家留言" prop="buyerMessage">
              <el-input
                v-model.trim="form.buyerMessage"
                placeholder="请输入买家留言"
              />
            </el-form-item>

            <el-form-item label="消费者资料" prop="consumerData">
              <el-input
                v-model.trim="form.consumerData"
                placeholder="请输入消费者资料"
              />
            </el-form-item>

            <el-form-item label="订单成交时间" prop="orderCompletionTime">
              <el-date-picker
                clearable
                v-model="form.orderCompletionTime"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择订单成交时间"
              >
              </el-date-picker>
            </el-form-item>
            <el-form-item
              label="消费者资料上传时间"
              prop="consumerDataUploadTime"
            >
              <el-date-picker
                clearable
                v-model="form.consumerDataUploadTime"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择消费者资料上传时间"
              >
              </el-date-picker>
            </el-form-item>
            <el-form-item label="赠品名称" prop="giftName">
              <el-input
                v-model.trim="form.giftName"
                placeholder="请输入赠品名称"
              />
            </el-form-item>
            <el-form-item label="赠品id" prop="giftId">
              <el-input v-model.trim="form.giftId" placeholder="请输入赠品id" />
            </el-form-item>
            <el-form-item label="赠品规格" prop="giftSpec">
              <el-input
                v-model.trim="form.giftSpec"
                placeholder="请输入赠品规格"
              />
            </el-form-item>
            <el-form-item label="赠品数量" prop="giftQuantity">
              <el-input
                v-model.trim="form.giftQuantity"
                placeholder="请输入赠品数量"
              />
            </el-form-item>
            <el-form-item label="团ID" prop="groupId">
              <el-input v-model.trim="form.groupId" placeholder="请输入团ID" />
            </el-form-item>
            <el-form-item label="团身份" prop="groupIdentity">
              <el-input
                v-model.trim="form.groupIdentity"
                placeholder="请输入团身份"
              />
            </el-form-item>
            <el-form-item label="是否已开始配送" prop="hasStartedDelivery">
              <el-input
                v-model.trim="form.hasStartedDelivery"
                placeholder="请输入是否已开始配送"
              />
            </el-form-item>
            <el-form-item label="配送员是否已送达" prop="hasDeliveryCompleted">
              <el-input
                v-model.trim="form.hasDeliveryCompleted"
                placeholder="请输入配送员是否已送达"
              />
            </el-form-item>
            <el-form-item label="同城是否普通快递" prop="isCityDelivery">
              <el-input
                v-model.trim="form.isCityDelivery"
                placeholder="请输入同城是否普通快递"
              />
            </el-form-item>
            <el-form-item label="商品总价(元)" prop="totalPrice">
              <el-input
                v-model.trim="form.totalPrice"
                placeholder="请输入商品总价(元)"
              />
            </el-form-item>
            <el-form-item label="邮费(元)" prop="postalFee">
              <el-input
                v-model.trim="form.postalFee"
                placeholder="请输入邮费(元)"
              />
            </el-form-item>
            <el-form-item label="店铺优惠折扣(元)" prop="storeDiscountAmount">
              <el-input
                v-model.trim="form.storeDiscountAmount"
                placeholder="请输入店铺优惠折扣(元)"
              />
            </el-form-item>
            <el-form-item
              label="平台优惠折扣(元)"
              prop="platformDiscountAmount"
            >
              <el-input
                v-model.trim="form.platformDiscountAmount"
                placeholder="请输入平台优惠折扣(元)"
              />
            </el-form-item>
            <el-form-item
              label="多多支付立减金额(元)"
              prop="multiplePaymentDiscountAmount"
            >
              <el-input
                v-model.trim="form.multiplePaymentDiscountAmount"
                placeholder="请输入多多支付立减金额(元)"
              />
            </el-form-item>
            <el-form-item label="上门安装费(元)" prop="homeInstallationAmount">
              <el-input
                v-model.trim="form.homeInstallationAmount"
                placeholder="请输入上门安装费(元)"
              />
            </el-form-item>
            <el-form-item label="送货入户费(元)" prop="deliveryFee">
              <el-input
                v-model.trim="form.deliveryFee"
                placeholder="请输入送货入户费(元)"
              />
            </el-form-item> </el-col
          ><el-col :span="8">
            <el-form-item
              label="送货入户并安装费(元)"
              prop="deliveryInstallationFee"
            >
              <el-input
                v-model.trim="form.deliveryInstallationFee"
                placeholder="请输入送货入户并安装费(元)"
              />
            </el-form-item>
            <el-form-item label="用户实付金额(元)" prop="userPaidAmount">
              <el-input
                v-model.trim="form.userPaidAmount"
                placeholder="请输入用户实付金额(元)"
              />
            </el-form-item>
            <el-form-item label="商家实收金额(元)" prop="receivedAmount">
              <el-input
                v-model.trim="form.receivedAmount"
                placeholder="请输入商家实收金额(元)"
              />
            </el-form-item>
            <el-form-item label="快递单号" prop="trackingNumber">
              <el-input
                v-model.trim="form.trackingNumber"
                placeholder="请输入快递单号"
              />
            </el-form-item>
            <el-form-item label="快递公司" prop="expressCompany">
              <el-input
                v-model.trim="form.expressCompany"
                placeholder="请输入快递公司"
              />
            </el-form-item>
            <el-form-item label="省" prop="province">
              <el-input v-model.trim="form.province" placeholder="请输入省" />
            </el-form-item>
            <el-form-item label="市" prop="cityName">
              <el-input v-model.trim="form.cityName" placeholder="请输入市" />
            </el-form-item>
            <el-form-item label="区" prop="area">
              <el-input v-model.trim="form.area" placeholder="请输入区" />
            </el-form-item>
            <el-form-item label="街道/镇" prop="streetOrTown">
              <el-input
                v-model.trim="form.streetOrTown"
                placeholder="请输入街道/镇"
              />
            </el-form-item>
            <el-form-item label="配送员手机号" prop="deliveryPhoneNumber">
              <el-input
                v-model.trim="form.deliveryPhoneNumber"
                placeholder="请输入配送员手机号"
              />
            </el-form-item>
            <el-form-item label="是否抽奖或0元试用" prop="isPromotionOrFree">
              <el-input
                v-model.trim="form.isPromotionOrFree"
                placeholder="请输入是否抽奖或0元试用"
              />
            </el-form-item>
            <el-form-item label="是否顺丰加价" prop="isFasterExpressPrice">
              <el-input
                v-model.trim="form.isFasterExpressPrice"
                placeholder="请输入是否顺丰加价"
              />
            </el-form-item>
            <el-form-item
              label="用户购买手机号"
              prop="userPurchasedPhoneNumber"
            >
              <el-input
                v-model.trim="form.userPurchasedPhoneNumber"
                placeholder="请输入用户购买手机号"
              />
            </el-form-item>
            <el-form-item label="旅行类信息" prop="travelDistance">
              <el-input
                v-model.trim="form.travelDistance"
                placeholder="请输入旅行类信息"
              />
            </el-form-item>
            <el-form-item label="充值号码" prop="rechargeNumber">
              <el-input
                v-model.trim="form.rechargeNumber"
                placeholder="请输入充值号码"
              />
            </el-form-item>
            <el-form-item label="是否门店自提" prop="isStorePickup">
              <el-input
                v-model.trim="form.isStorePickup"
                placeholder="请输入是否门店自提"
              />
            </el-form-item>
            <el-form-item label="逻辑删除" prop="isDelete">
              <el-input
                v-model.trim="form.isDelete"
                placeholder="请输入逻辑删除"
              />
            </el-form-item>
            <el-form-item label="备注" prop="remark">
              <el-input v-model.trim="form.remark" placeholder="请输入备注" />
            </el-form-item>
            <el-form-item label="店铺id" prop="shopId">
              <el-input v-model.trim="form.shopId" placeholder="请输入店铺id" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 添加或修改产品二级信息对话框 :on-change="handleChange"-->
    <el-dialog
      title="导入"
      :visible.sync="dialogVisible"
      width="500px"
      append-to-body
      v-if="dialogVisible"
    >
      <!-- 文件上传-->
      <el-form
        :rules="rules"
        :model="dataForm"
        ref="dataForm"
        label-width="150px"
        @submit.native.prevent
      >
        <!-- <el-form-item label="模板下载" prop="finalIsReturn">
          <el-button size="mini" @click="downLoadTemplateFile">
            导入模板下载
          </el-button>
        </el-form-item> -->
        <el-form-item label="店铺：" prop="name">
          <el-select v-model="dataForm.name" placeholder="店铺" clearable>
            <el-option
              v-for="dict in cascadeList"
              :key="dict.id"
              :label="dict.storeName"
              :value="dict.shopId"
            />
          </el-select>
          <!-- <el-input
            type="text"
            v-model.trim="dataForm.name"
            clearable
          ></el-input> -->
          <!-- <el-cascader
            class="region"
            v-model="dataForm.name"
            placeholder="选择店铺分组"
            :options="cascadeList"
            :props="{ checkStrictly: true }"
            style="width: 300px; height: 30px"
          >
          </el-cascader> -->
        </el-form-item>
        <el-form-item label="文件：" prop="file">
          <el-upload
            class="upload-import"
            ref="uploadImport"
            :http-request="httpRequest"
            action=""
            :on-remove="handleRemove"
            :file-list="fileList"
            :limit="1"
            :on-change="handleChange"
            :auto-upload="false"
            :before-upload="beforeAvatarUpload"
          >
            <!--
            accept="application/zip,.zip" 设置接收的文件类型-->
            <el-button
              v-show="!hasFile"
              slot="trigger"
              size="small"
              type="primary"
              >选取文件</el-button
            >
            <!-- <div slot="tip" class="el-upload__tip">
          只能上传zip文件，且不超过10M
        </div> -->
          </el-upload>
          <!-- 关闭自动上传-->
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="submitUpload">提交</el-button>
          <!-- <el-button @click="resetForm('ruleForm')">重置</el-button> -->
          <el-button @click="dialogVisible = false">取 消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>

    <el-dialog
      :visible.sync="openInfo"
      width="700px"
      append-to-body
      title="选择时间"
    >
      <timeSearch
        @getDateArr="getDateArr"
        @changDay="changDay"
        :timeArr="timeArr"
        :dayActive="this.dayActive"
        :dayLimit="1095"
      />
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="handleorderCostCalculator"
          >按时间计算成本</el-button
        >
        <!-- <el-button @click="cancel">取 消</el-button> -->
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listBiPddOrderDwd,
  getBiPddOrderDwd,
  delBiPddOrderDwd,
  addBiPddOrderDwd,
  updateBiPddOrderDwd,
  orderCostCalculator,
  orderCostCalculatorByIds,
} from "@/api/pdd/BiPddOrderDwd";
import {
  listBiPddPromotionDwd,
  getBiPddPromotionDwd,
  delBiPddPromotionDwd,
  addBiPddPromotionDwd,
  updateBiPddPromotionDwd,
  selectShopList,
} from "@/api/pdd/BiPddPromotionDwd";
//--------导入token
import { getToken } from "@/utils/auth";
import axios from "axios";
import timeSearch from "@/common/day";
export default {
  name: "BiPddOrderDwd",
  components: { timeSearch },
  data() {
    return {
      dateRange: [], // 初始化空数组
      openInfo: false,
      dayActive: 2,
      timeArr: [
        { value: "2", label: "昨天" },
        { value: "7", label: "最近7天" },
        { value: "30", label: "最近30天" },
        { value: "365", label: "最近一年" },
        { value: "1", label: "日" },
      ],
      timeGap: { startTime: "", endTime: "" },

      hasFile: false,
      fileList: [],
      dialogVisible: false,
      pjtUrl: process.env.VUE_APP_BASE_API,

      cascadeList: [],
      dataForm: {
        name: null,
        file: null,
      },

      isOpen: false,
      inputValue: "",
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 拼多多订单表格数据
      BiPddOrderDwdList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        productName: null,
        orderNumber: null,
        orderStatus: null,
        productQuantity: null,
        isReviewing: null,
        dataDate: null,
        commitShipmentDate: null,
        promiseDeliveryTime: null,
        estimatedShipmentDate: null,
        confirmationTime: null,
        productCost: null,
        productId: null,
        productSpecification: null,
        styleId: null,
        productFirstCategory: null,
        productSecondCategory: null,
        productThirdCategory: null,
        productFourthCategory: null,
        merchantCodeSpec: null,
        merchantProductCode: null,
        merchantNotes: null,
        buyerMessage: null,
        postSaleStatus: null,
        consumerData: null,
        orderCompletionTime: null,
        consumerDataUploadTime: null,
        giftName: null,
        giftId: null,
        giftSpec: null,
        giftQuantity: null,
        groupId: null,
        groupIdentity: null,
        hasStartedDelivery: null,
        hasDeliveryCompleted: null,
        deliveryStatus: null,
        isCityDelivery: null,
        totalPrice: null,
        postalFee: null,
        storeDiscountAmount: null,
        platformDiscountAmount: null,
        multiplePaymentDiscountAmount: null,
        homeInstallationAmount: null,
        deliveryFee: null,
        deliveryInstallationFee: null,
        userPaidAmount: null,
        receivedAmount: null,
        trackingNumber: null,
        expressCompany: null,
        province: null,
        cityName: null,
        area: null,
        streetOrTown: null,
        deliveryPhoneNumber: null,
        isPromotionOrFree: null,
        isFasterExpressPrice: null,
        userPurchasedPhoneNumber: null,
        travelDistance: null,
        rechargeNumber: null,
        isStorePickup: null,
        isDelete: null,
        shopId: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
    };
  },
  created() {
    this.getList();
  },
  methods: {
    OptionsRange(m1, m2) {
      // console.log(JSON.stringify(m));
      this.queryParams.startDate = m1;
      this.queryParams.endDate = m2;
    },
    //时间控件
    changDay(val) {
      this.dayActive = val;
      this.timeGap.startTime = val[0];
      this.timeGap.endTime = val[1];
    },
    getDateArr(value) {
      this.timeGap.startTime = value[0];
      this.timeGap.endTime = value[1];
      console.log(JSON.stringify(this.timeGap));
      this.dayActive = 1;
    },
    /** 同步品类信息 Warning*/
    handleorderCostCalculator() {
      // this.$modal.msgWarning("数据正在同步，请稍候");

      const obj = {
        startDate: this.timeGap.startTime,
        endDate: this.timeGap.endTime,
      };
      this.openLoading();
      orderCostCalculator(obj).then((response) => {
        this.$modal.msgSuccess(response.msg);
        this.$modal.closeLoading();
        this.openInfo = false;
        this.getList();

        // this.$store.dispatch('dict/cleanDict');
      });
    },
    // 打开加载层
    openLoading() {
      this.$modal.loading("正在加载，请稍候！");
    },
    handleorderCostCalculatorByIds() {
      if (this.ids.length == 0) {
        this.$modal.msgError("请选择一条数据");
        return;
      }
      this.openLoading();
      orderCostCalculatorByIds(this.ids).then((response) => {
        this.$modal.closeLoading();
        this.$modal.msgSuccess(response.msg);
        this.getList();
      });
    },
    //搜索栏展示与收起
    shouqi() {
      // console.log(1);
      this.isOpen = !this.isOpen;
    },
    /** 查询拼多多订单列表 */
    getList() {
      this.loading = true;
      listBiPddOrderDwd(this.queryParams).then((response) => {
        this.BiPddOrderDwdList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        productName: null,
        orderNumber: null,
        orderStatus: null,
        productQuantity: null,
        isReviewing: null,
        dataDate: null,
        commitShipmentDate: null,
        promiseDeliveryTime: null,
        estimatedShipmentDate: null,
        confirmationTime: null,
        productCost: null,
        productId: null,
        productSpecification: null,
        styleId: null,
        productFirstCategory: null,
        productSecondCategory: null,
        productThirdCategory: null,
        productFourthCategory: null,
        merchantCodeSpec: null,
        merchantProductCode: null,
        merchantNotes: null,
        buyerMessage: null,
        postSaleStatus: null,
        consumerData: null,
        orderCompletionTime: null,
        consumerDataUploadTime: null,
        giftName: null,
        giftId: null,
        giftSpec: null,
        giftQuantity: null,
        groupId: null,
        groupIdentity: null,
        hasStartedDelivery: null,
        hasDeliveryCompleted: null,
        deliveryStatus: null,
        isCityDelivery: null,
        totalPrice: null,
        postalFee: null,
        storeDiscountAmount: null,
        platformDiscountAmount: null,
        multiplePaymentDiscountAmount: null,
        homeInstallationAmount: null,
        deliveryFee: null,
        deliveryInstallationFee: null,
        userPaidAmount: null,
        receivedAmount: null,
        trackingNumber: null,
        expressCompany: null,
        province: null,
        cityName: null,
        area: null,
        streetOrTown: null,
        deliveryPhoneNumber: null,
        isPromotionOrFree: null,
        isFasterExpressPrice: null,
        userPurchasedPhoneNumber: null,
        travelDistance: null,
        rechargeNumber: null,
        isStorePickup: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        isDelete: null,
        remark: null,
        shopId: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.queryParams.pageSize = 10;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.queryParams = {};
      this.dateRange = [];
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加拼多多订单";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids;
      getBiPddOrderDwd(id).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = "修改拼多多订单";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.id != null) {
            updateBiPddOrderDwd(this.form).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addBiPddOrderDwd(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal
        .confirm('是否确认删除拼多多订单编号为"' + ids + '"的数据项？')
        .then(function () {
          return delBiPddOrderDwd(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "pdd/BiPddOrderDwd/export",
        {
          ...this.queryParams,
        },
        `BiPddOrderDwd_${new Date().getTime()}.xlsx`
      );
    },

    //图片上传前的相关判断
    beforeAvatarUpload(file) {
      // const isJPG = file.type == 'image/jpeg' || file.type == 'image/png';
      const isLt2M = file.size / 1024 / 1024 < 100;
      // if (!isJPG) {
      //     this.$message.error('上传头像图片只能是 JPG/PNG 格式!');
      // }
      if (!isLt2M) {
        this.$message.error("上传导入文件大小不能超过 100MB!");
      }

      return isLt2M;
    },
    handleRemove(file, fileList) {
      if (!fileList.length) {
        this.hasFile = false;
      }
      this.dataForm.file = null;
    },
    handleChange(file, fileList) {
      if (fileList.length >= 2) {
        return;
      }
      if (fileList.length === 1) {
        this.hasFile = true;
      }
      this.dataForm.file = file;
    },
    //确定按钮
    //调用组件upload的submit方法，从而触发httpRequest方法，实现手动上传
    submitUpload() {
      this.$refs["dataForm"].validate((valid) => {
        if (valid) {
          this.$refs.uploadImport.submit();
        }
      });
    },
    httpRequest(param) {
      //   if (this.dataForm.name.length < 3) {
      //     this.$modal.msgWarning("请选择到店铺");
      //     return;
      //   }
      let fd = new FormData();
      fd.append("file", param.file); // 传文件
      // fd.append("salesGrade", this.dataForm.name);
      //dataPar.file.raw
      console.log(JSON.stringify(fd));
      this.openLoading1();
      axios
        .post(
          process.env.VUE_APP_BASE_API +
            "/pdd/BiPddOrderDwd/importData?shopId=" +
            this.dataForm.name,
          fd,
          {
            headers: {
              header: { responseType: "blob" },

              Authorization: "Bearer " + getToken(),
              "Content-Type": "multipart/form-data",
            }, //定义内容格式,很重要
            // timeout: 20000,
          }
        )
        .then((response) => {
          console.log(response);
          if (response.data.code == 200) {
            this.dialogVisible = false;
            this.$modal.closeLoading();
            this.$modal.msgSuccess("导入成功");
            this.hasFile = false;
            this.getList();
          }
        });
    },
    getselectShopList() {
      selectShopList().then((response) => {
        this.cascadeList = response;
      });
    },
    //部门文件导入修改打开
    daoru() {
      this.getselectShopList();
      this.dialogVisible = true;
    },
    // 打开加载层
    openLoading1() {
      this.$modal.loading("正在导入，请稍候！");
    },
  },
};
</script>
